package io.buffered;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;

//统计某个普通文件有多少行代码
public class Demo05FileLines {
    public static void main(String[] args) throws Exception {
        File file = new File("F://Test//T1//hello.java");
        BufferedReader bw = new BufferedReader(new FileReader(file));
        int count = 0;

        String s;
        while ((s = bw.readLine()) != null) {
            if (s.trim().length() != 0)
                count++;
        }

        System.out.println(count);
    }
}
